package com.zyh.study.myForestDemoPlus;


import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.f4b6a3.ulid.Ulid;
import lombok.Data;

/**
 * @Classname OrderReqDTO
 * @Description TODO()
 * @Date 2025-09-07 0:52
 * @Created by 86177
 */
@Data
public class OrderEventDTO {
    @JsonProperty("account_id")
    private String accountId;

    // ISO8601时间戳
    @JsonProperty("at")
    private String at;

    // 事件类型：new/fill/canceled等
    @JsonProperty("event")
    private String eventType;

    // ULID格式的事件ID
    @JsonProperty("event_id")
    private String eventId;

    @JsonProperty("execution_id")
    private String executionId;

    @JsonProperty("previous_execution_id")
    private String previousExecutionId;

    // 订单详情
    @JsonProperty("order")
    private OrderRespSseDTO order;

    // ISO8601时间戳
    @JsonProperty("timestamp")
    private String timestamp;

    // 添加ULID比较方法
    public Ulid getUlid() {
        return Ulid.from(eventId);
    }

    // 添加比较方法
    public int compareTo(OrderEventDTO other) {
        return this.getUlid().compareTo(other.getUlid());
    }

}
